
//% color="#1296db" iconWidth=50 iconHeight=40
namespace RS485 {
    //% block="初始化RS485" blockType="command" blockType="command"
    export function RS485(parameter: any, block: any) {
        Generator.addInclude('RS485', '#include <RS485.h>');   
        Generator.addObject(`rs485`, `RS485`, `rs485;`);    
        Generator.addSetup(`Serial.begin`, `Serial.begin(9600);`);         
    }

    //% block="返回氮的值" blockType="reporter"
    export function readN(parameter: any, block: any) {
        Generator.addCode(`rs485.readN()`);
    }

    //% block="返回磷的值" blockType="reporter"
    export function readP(parameter: any, block: any) {
            Generator.addCode(`rs485.readP()`);
    }

    //% block="返回钾的值" blockType="reporter"
    export function readK(parameter: any, block: any) {
        
        Generator.addCode(`rs485.readK()`);
    }


    //% block="湿度值" blockType="reporter"
    export function TEM(parameter: any, block: any) {
        
        Generator.addCode(`rs485. readHumiture_Hum()`);
    }
    //% block="温度值" blockType="reporter"
    export function HUM(parameter: any, block: any) {
        
    Generator.addCode(`rs485.readHumiture_Tem()`);
    }

    //% block="电导率EC值" blockType="reporter"
     export function PH_EC(parameter: any, block: any) {
        Generator.addCode(`rs485.readECPH_Ec()`);
    }
    
    //% block="电导率湿度值" blockType="reporter"
     export function PH_ECTEM(parameter: any, block: any) {
        Generator.addCode(`rs485.readHumitureEC_Tem()`);
    }
    //% block="电导率温度值" blockType="reporter"
     export function PH_ECHUM(parameter: any, block: any) {
        Generator.addCode(`rs485.readHumitureEC_Hum()`);
    }
    //% block="PH值" blockType="reporter"
      export function readECPH_Ph(parameter: any, block: any) {
        Generator.addCode(`rs485.readECPH_Ph()`);
    }    
   
}